/**
 * @author   Ivan Andonov
 * @email:   ivan.andonov[at]gmail[dot]com
 * 
 * @require  sjs, sjs.Delegate, sjs.Utils, jquery
 * @use      sjs.Debug
 * @optional 
 **/

(function() {

	sjs.create('sjs.Form.RadioGroup', {
		
		// CONSTRUCTOR
		initialize : function(group){
			//$log(this+' group='+group);
			
			// PUBLIC VARS
			this.group = $e(group);
			
			// PUBLIC METHODS
			this.getIndex = function() {
				var len = this.group.length;
				for (var i = 0; i < len; i++) {
					if((new sjs.Form.Radio(this.group[index])).checked()) {
						return i;
					}
				}
				return '';
			};
			
			this.value = function() {
				var index = this.getIndex();
				var radio = new sjs.Form.Radio(this.group[index]);
				return radio.value();
			};
		}
		
	});
	
})();